using System;
using System.Windows.Forms;

namespace ctsu.BaseForms
{
	public class FormReportTimePeriodBase : System.Windows.Forms.Form
	{
		public IFormReportTimePeriodBaseController Controller;

		protected System.Windows.Forms.GroupBox gbxCriteria;
		protected Syncfusion.Windows.Forms.Tools.DateTimePickerAdv EndDate;
		protected System.Windows.Forms.Label label1;
		public System.Windows.Forms.TextBox Count;
		protected System.Windows.Forms.Label label3;
		protected System.Windows.Forms.Button btnRun;
		protected Syncfusion.Windows.Forms.Tools.DateTimePickerAdv BeginDate;
		protected System.Windows.Forms.Label label2;
		protected System.Windows.Forms.DataGrid dg;
		protected System.Windows.Forms.Button btnExit;
		public System.Windows.Forms.Button btnPrint;
		private System.ComponentModel.Container components = null;

		public DataGrid Grid
		{
			get { return dg; }
		}

		public DateTime BeginPeriodDate
		{
			get
			{
				if (BeginDate.IsNullDate)
					return new DateTime(0);
				else
					return BeginDate.Value;
			}
		}
		public DateTime EndPeriodDate
		{
			get
			{
				if (EndDate.IsNullDate)
					return new DateTime(0);
				else
					return EndDate.Value;
			}
		}

		public FormReportTimePeriodBase()
		{
			InitializeComponent();
		}

		protected override void Dispose(bool disposing)
		{
			if (disposing)
			{
				if (components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose(disposing);
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.gbxCriteria = new System.Windows.Forms.GroupBox();
			this.EndDate = new Syncfusion.Windows.Forms.Tools.DateTimePickerAdv();
			this.label1 = new System.Windows.Forms.Label();
			this.Count = new System.Windows.Forms.TextBox();
			this.label3 = new System.Windows.Forms.Label();
			this.btnRun = new System.Windows.Forms.Button();
			this.BeginDate = new Syncfusion.Windows.Forms.Tools.DateTimePickerAdv();
			this.label2 = new System.Windows.Forms.Label();
			this.dg = new System.Windows.Forms.DataGrid();
			this.btnExit = new System.Windows.Forms.Button();
			this.btnPrint = new System.Windows.Forms.Button();
			this.gbxCriteria.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.EndDate)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.EndDate.Calendar)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.BeginDate)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.BeginDate.Calendar)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.dg)).BeginInit();
			this.SuspendLayout();
			// 
			// gbxCriteria
			// 
			this.gbxCriteria.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
						| System.Windows.Forms.AnchorStyles.Right)));
			this.gbxCriteria.Controls.Add(this.EndDate);
			this.gbxCriteria.Controls.Add(this.label1);
			this.gbxCriteria.Controls.Add(this.Count);
			this.gbxCriteria.Controls.Add(this.label3);
			this.gbxCriteria.Controls.Add(this.btnRun);
			this.gbxCriteria.Controls.Add(this.BeginDate);
			this.gbxCriteria.Controls.Add(this.label2);
			this.gbxCriteria.Location = new System.Drawing.Point(8, 0);
			this.gbxCriteria.Name = "gbxCriteria";
			this.gbxCriteria.Size = new System.Drawing.Size(640, 56);
			this.gbxCriteria.TabIndex = 3;
			this.gbxCriteria.TabStop = false;
			this.gbxCriteria.Text = "Criteria";
			// 
			// EndDate
			// 
			this.EndDate.BackgroundColor = new Syncfusion.Drawing.BrushInfo();
			this.EndDate.Border3DStyle = System.Windows.Forms.Border3DStyle.Flat;
			this.EndDate.BorderColor = System.Drawing.SystemColors.ControlDark;
			this.EndDate.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			// 
			// 
			// 
			this.EndDate.Calendar.AllowMultipleSelection = false;
			this.EndDate.Calendar.Culture = new System.Globalization.CultureInfo("");
			this.EndDate.Calendar.DaysFont = new System.Drawing.Font("Verdana", 8F);
			this.EndDate.Calendar.DaysHeaderInterior = new Syncfusion.Drawing.BrushInfo(System.Drawing.SystemColors.Window);
			this.EndDate.Calendar.Dock = System.Windows.Forms.DockStyle.Fill;
			this.EndDate.Calendar.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
			this.EndDate.Calendar.GridLines = Syncfusion.Windows.Forms.Grid.GridBorderStyle.None;
			this.EndDate.Calendar.HeaderHeight = 20;
			this.EndDate.Calendar.HeaderStartColor = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(128)))), ((int)(((byte)(62)))));
			this.EndDate.Calendar.Location = new System.Drawing.Point(0, 0);
			this.EndDate.Calendar.MinValue = new System.DateTime(1753, 1, 1, 0, 0, 0, 0);
			this.EndDate.Calendar.Name = "monthCalendar";
			// 
			// 
			// 
			this.EndDate.Calendar.NoneButton.Location = new System.Drawing.Point(131, 0);
			this.EndDate.Calendar.ScrollButtonSize = new System.Drawing.Size(24, 24);
			this.EndDate.Calendar.SelectedDates = new System.DateTime[] {
        new System.DateTime(2007, 4, 5, 7, 10, 57, 939)};
			this.EndDate.Calendar.Size = new System.Drawing.Size(203, 174);
			this.EndDate.Calendar.SizeToFit = true;
			this.EndDate.Calendar.Style = Syncfusion.Windows.Forms.VisualStyle.Office2003;
			this.EndDate.Calendar.TabIndex = 0;
			// 
			// 
			// 
			this.EndDate.Calendar.TodayButton.Location = new System.Drawing.Point(0, 0);
			this.EndDate.Calendar.TodayButton.Size = new System.Drawing.Size(131, 20);
			this.EndDate.Calendar.WeekFont = new System.Drawing.Font("Verdana", 8F);
			this.EndDate.Calendar.WeekInterior = new Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.GradientStyle.Vertical, System.Drawing.Color.PeachPuff, System.Drawing.Color.AntiqueWhite);
			this.EndDate.CalendarFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
			this.EndDate.DropDownImage = null;
			this.EndDate.Format = System.Windows.Forms.DateTimePickerFormat.Short;
			this.EndDate.Location = new System.Drawing.Point(336, 24);
			this.EndDate.Name = "EndDate";
			this.EndDate.NullString = "";
			this.EndDate.ShowCheckBox = false;
			this.EndDate.Size = new System.Drawing.Size(96, 20);
			this.EndDate.Style = Syncfusion.Windows.Forms.VisualStyle.Office2003;
			this.EndDate.TabIndex = 8;
			this.EndDate.Value = new System.DateTime(2007, 4, 5, 7, 10, 57, 939);
			this.EndDate.ValueChanged += new System.EventHandler(this.Date_ValueChanged);
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(272, 24);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(64, 16);
			this.label1.TabIndex = 7;
			this.label1.Text = "End date:";
			// 
			// Count
			// 
			this.Count.Location = new System.Drawing.Point(576, 24);
			this.Count.Name = "Count";
			this.Count.ReadOnly = true;
			this.Count.Size = new System.Drawing.Size(48, 22);
			this.Count.TabIndex = 6;
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(528, 24);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(48, 16);
			this.label3.TabIndex = 5;
			this.label3.Text = "Count:";
			// 
			// btnRun
			// 
			this.btnRun.Location = new System.Drawing.Point(8, 24);
			this.btnRun.Name = "btnRun";
			this.btnRun.Size = new System.Drawing.Size(75, 23);
			this.btnRun.TabIndex = 4;
			this.btnRun.Text = "Run";
			this.btnRun.Click += new System.EventHandler(this.btnRun_Click);
			// 
			// BeginDate
			// 
			this.BeginDate.BackgroundColor = new Syncfusion.Drawing.BrushInfo();
			this.BeginDate.Border3DStyle = System.Windows.Forms.Border3DStyle.Flat;
			this.BeginDate.BorderColor = System.Drawing.SystemColors.ControlDark;
			this.BeginDate.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			// 
			// 
			// 
			this.BeginDate.Calendar.AllowMultipleSelection = false;
			this.BeginDate.Calendar.Culture = new System.Globalization.CultureInfo("");
			this.BeginDate.Calendar.DaysFont = new System.Drawing.Font("Verdana", 8F);
			this.BeginDate.Calendar.DaysHeaderInterior = new Syncfusion.Drawing.BrushInfo(System.Drawing.SystemColors.Window);
			this.BeginDate.Calendar.Dock = System.Windows.Forms.DockStyle.Fill;
			this.BeginDate.Calendar.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
			this.BeginDate.Calendar.GridLines = Syncfusion.Windows.Forms.Grid.GridBorderStyle.None;
			this.BeginDate.Calendar.HeaderHeight = 20;
			this.BeginDate.Calendar.HeaderStartColor = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(128)))), ((int)(((byte)(62)))));
			this.BeginDate.Calendar.Location = new System.Drawing.Point(0, 0);
			this.BeginDate.Calendar.MinValue = new System.DateTime(1753, 1, 1, 0, 0, 0, 0);
			this.BeginDate.Calendar.Name = "monthCalendar";
			// 
			// 
			// 
			this.BeginDate.Calendar.NoneButton.Location = new System.Drawing.Point(131, 0);
			this.BeginDate.Calendar.ScrollButtonSize = new System.Drawing.Size(24, 24);
			this.BeginDate.Calendar.SelectedDates = new System.DateTime[] {
        new System.DateTime(2007, 4, 5, 7, 10, 58, 179)};
			this.BeginDate.Calendar.Size = new System.Drawing.Size(203, 174);
			this.BeginDate.Calendar.SizeToFit = true;
			this.BeginDate.Calendar.Style = Syncfusion.Windows.Forms.VisualStyle.Office2003;
			this.BeginDate.Calendar.TabIndex = 0;
			// 
			// 
			// 
			this.BeginDate.Calendar.TodayButton.Location = new System.Drawing.Point(0, 0);
			this.BeginDate.Calendar.TodayButton.Size = new System.Drawing.Size(131, 20);
			this.BeginDate.Calendar.WeekFont = new System.Drawing.Font("Verdana", 8F);
			this.BeginDate.Calendar.WeekInterior = new Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.GradientStyle.Vertical, System.Drawing.Color.PeachPuff, System.Drawing.Color.AntiqueWhite);
			this.BeginDate.CalendarFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
			this.BeginDate.DropDownImage = null;
			this.BeginDate.Format = System.Windows.Forms.DateTimePickerFormat.Short;
			this.BeginDate.Location = new System.Drawing.Point(168, 24);
			this.BeginDate.Name = "BeginDate";
			this.BeginDate.NullString = "";
			this.BeginDate.ShowCheckBox = false;
			this.BeginDate.Size = new System.Drawing.Size(96, 20);
			this.BeginDate.Style = Syncfusion.Windows.Forms.VisualStyle.Office2003;
			this.BeginDate.TabIndex = 3;
			this.BeginDate.Value = new System.DateTime(2007, 4, 5, 7, 10, 58, 179);
			this.BeginDate.ValueChanged += new System.EventHandler(this.Date_ValueChanged);
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(96, 24);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(72, 16);
			this.label2.TabIndex = 2;
			this.label2.Text = "Begin date:";
			// 
			// dg
			// 
			this.dg.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
						| System.Windows.Forms.AnchorStyles.Left)
						| System.Windows.Forms.AnchorStyles.Right)));
			this.dg.DataMember = "";
			this.dg.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.dg.Location = new System.Drawing.Point(0, 64);
			this.dg.Name = "dg";
			this.dg.Size = new System.Drawing.Size(656, 368);
			this.dg.TabIndex = 4;
			// 
			// btnExit
			// 
			this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
			this.btnExit.Location = new System.Drawing.Point(264, 440);
			this.btnExit.Name = "btnExit";
			this.btnExit.Size = new System.Drawing.Size(75, 23);
			this.btnExit.TabIndex = 9;
			this.btnExit.Text = "Exit";
			this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
			// 
			// btnPrint
			// 
			this.btnPrint.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
			this.btnPrint.Enabled = false;
			this.btnPrint.Location = new System.Drawing.Point(176, 440);
			this.btnPrint.Name = "btnPrint";
			this.btnPrint.Size = new System.Drawing.Size(75, 23);
			this.btnPrint.TabIndex = 8;
			this.btnPrint.Text = "Print";
			this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
			// 
			// FormReportTimePeriodBase
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
			this.ClientSize = new System.Drawing.Size(656, 470);
			this.Controls.Add(this.btnExit);
			this.Controls.Add(this.btnPrint);
			this.Controls.Add(this.dg);
			this.Controls.Add(this.gbxCriteria);
			this.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
			this.Name = "FormReportTimePeriodBase";
			this.Text = "FormReportTimePeriodBase";
			this.gbxCriteria.ResumeLayout(false);
			this.gbxCriteria.PerformLayout();
			((System.ComponentModel.ISupportInitialize)(this.EndDate.Calendar)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.EndDate)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.BeginDate.Calendar)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.BeginDate)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.dg)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		private void btnRun_Click(object sender, System.EventArgs e)
		{
			Controller.Run(sender, e);
		}

		private void btnPrint_Click(object sender, System.EventArgs e)
		{
			Controller.Print(sender, e);
		}

		private void btnExit_Click(object sender, System.EventArgs e)
		{
			Controller.Exit(sender, e);
		}

		private void Date_ValueChanged(object sender, System.EventArgs e)
		{
			Controller.GenericAction((Control)sender, e);
		}
	}
}
